GOFILES := `find . -name "*.go" -type f -not -path "./vendor/*"`
CGO_ENABLED_FLAG ?= 0

ifeq ($(OS),Windows_NT)
	GOOS_FLAG = windows
else
	UNAME_S := $(shell uname -s)
	ifeq ($(UNAME_S), Linux)
		GOOS_FLAG = linux
	endif
	ifeq ($(UNAME_S), Darwin)
		GOOS_FLAG = darwin
	endif
endif

all: tools fmt test

clean:
	@go clean
test:
	@go test ./test
fmt:
	@gofumpt -w -l .
tidy:
	@go mod tidy
update:
	@go get -u ./...
	@go mod tidy
tools:
	go install mvdan.cc/gofumpt@latest
	go install golang.org/x/tools/cmd/cover@latest
	sh -c "$$(wget -O - -q https://install.goreleaser.com/github.com/golangci/golangci-lint.sh || echo exit 2)" -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)

.PHONY: clean fmt test tools
